'"curve to" example from http://cairographics.org/samples'

out_file_name = __file__[:-1] + 'ng'#'example_curve_to.png'

surface_width = 256
surface_height = 256

import os
os.environ['_CAIRO_LIBRARY_'] = 'cairo_1_10_2'

from cairo_ctypes import *

x, y = 25.6, 128.0
x1, y1 = 102.4, 230.4
x2, y2 = 153.6, 25.6
x3, y3 = 230.4, 128.0

surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, surface_width, surface_height);
cr = cairo_create(surface)

cairo_move_to (cr, x, y);
cairo_curve_to (cr, x1, y1, x2, y2, x3, y3);

cairo_set_line_width (cr, 10.0);
cairo_stroke (cr);

cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6);
cairo_set_line_width (cr, 6.0);
cairo_move_to (cr,x,y);   cairo_line_to (cr,x1,y1);
cairo_move_to (cr,x2,y2); cairo_line_to (cr,x3,y3);
cairo_stroke (cr);

cairo_surface_write_to_png(surface, out_file_name)

print('Result see in %s' % out_file_name)
